/** 
将以下格式
{
  '0': 'name1',
  '1': 'name2'
}
转化为select option常用格式
  [
    { value: "1", label: "启用" },
    { value: "0", label: "禁用" }
  ]
 */
export function formatOption(obj, key = "value", lable = "label") {
  if (!(Object.prototype.toString.call(obj) === "[object Object]")) {
    return obj;
  }
  const keys = Object.keys(obj);
  const arr = [];
  keys.forEach(item => {
    arr.push({
      [key]: item,
      [lable]: obj[item]
    });
  });

  return arr;
}
